package com.neusoft.yiyang.diet.controller;

import com.neusoft.yiyang.common.entity.diet.DietTag;
import com.neusoft.yiyang.diet.service.DietTagService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Tag(name = "饮食标签管理接口", description = "负责管理饮食标签的创建、查询等操作")
@RestController
@RequestMapping("/diet-tags")
public class DietTagController {

    @Autowired
    private DietTagService dietTagService;

    @Operation(summary = "添加饮食标签", description = "创建新的饮食标签（如糖尿病、素食等）")
    @PostMapping("/add")
    public void addDietTag(
            @io.swagger.v3.oas.annotations.parameters.RequestBody(description = "饮食标签信息（含名称、描述等）", required = true)
            @RequestBody DietTag dietTag) {
        dietTagService.addDietTag(dietTag);
    }

    @Operation(summary = "获取所有饮食标签", description = "查询系统中所有可用的饮食标签列表")
    @GetMapping("/all")
    public List<DietTag> getAllDietTags() {
        return dietTagService.getAllDietTags();
    }
}